package com.czl.module_storehouse.mvp.presenter;

import com.czl.module_base.bean.FileServiceResult;
import com.czl.module_base.http.HttpResponse;
import com.czl.module_base.mvp.presenter.BasePresenter;
import com.czl.module_base.observer.AbsHandleSubscriber;
import com.czl.module_storehouse.mvp.model.UploadModel;
import com.czl.module_storehouse.mvp.view.UploadView;

/**
 * @author by xubin,
 * @date on 2022/2/25.
 * PS: Not easy to write code, please indicate.
 */
public class UploadPresenter extends BasePresenter<UploadModel, UploadView> {
    public static String TAG_UPLOAD_FILE = "upload_file";

    public void uploadFile(String path) {
        doSubscribe2(mModel.uploadPath(path), new AbsHandleSubscriber<HttpResponse<FileServiceResult>>(true) {
            @Override
            public void onSuccess(HttpResponse<FileServiceResult> httpResponse) {
                httpResponse.setRequestTag(TAG_UPLOAD_FILE);
                mView.showHttpResponse(httpResponse);
            }
        });
    }

}
